﻿using System.Data.Entity.ModelConfiguration;

namespace HobSoft.SoccerBet2014.Domain.Models.DbSchema
{
    public class BmAccountConfiguration : EntityTypeConfiguration<BmAccount>
    {
        public BmAccountConfiguration(string schema = "dbo")
        {
            ToTable(schema + ".Account_List");
            HasKey(a => new { a.BmID, a.Account });
            HasRequired(a => a.Booker).WithMany(b => b.Accounts).HasForeignKey(a => a.BmID).WillCascadeOnDelete();
            Property(a => a.BmID).HasColumnName("BmID").IsRequired();
            Property(a => a.Account).HasColumnName("Account").IsRequired().HasMaxLength(50).IsUnicode(false);
            Property(a => a.Password).HasColumnName("Password").IsRequired().HasMaxLength(50).IsUnicode(false);
            //Property(a => a.LastRequestTime).HasColumnName("LastRequestTime").IsOptional();
            Property(a => a.Available).HasColumnName("Available").IsOptional();
            Ignore(a => a.LastRequestTime);
            Ignore(a => a.Discount);
        }
    }
}
